up: embedded systems - bacnet - message formats - bacnet-ip  
embedded systems - bacnet - Context TagWhat links here?
The context tag encodes the context number and length.
The datatype of the tagged data is determined by the context (production) in which it appears; without the context one cannot tell if a data item with four bytes is an INTEGER, Unsigned, REAL, Date, or Time, for example.

+---+---+---+---+---+---+---+---+
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---+---+---+---+---+---+---+---+
|    tag no.    | c |   l/v/t   |
+---+---+---+---+---+---+---+---+


offsetmeaning
0 bits 7 - 4tag number
0 bit 3class (1 for context tag)
0 bits 2 - 0length, value, or type


Tag Number
If the Tag Number is less than 15, it is the tag number for the following data.
If the Tag Number equals 15, and the Length = 5, the octet after the context tag contains the context number, the octet after that contains the extended length, and the data follows:

+---+---+---+---+---+---+---+---+
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---+---+---+---+---+---+---+---+
| 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | (tag number = 15, class = context tag, L/v/t = 5 = length uses extension octets
+---+---+---+---+---+---+---+---+
| context number                |
+---+---+---+---+---+---+---+---+
| data length                   |
+---+---+---+---+---+---+---+---+
| data ...                      |
+---+---+---+---+---+---+---+---+




Class
0 indicates an application tag. The tag number indicates the type.
1 indicates a context specific tag.

Length
For length = 0 to 4, this is the number of octets following containing the data.
For length = 5, the next octet after the context tag contains the 'extended length'. That value describes the number of octests following the extended length containing the data.

+---+---+---+---+---+---+---+---+
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---+---+---+---+---+---+---+---+
|    tag no.    | 1 | 1 | 0 | 1 |
+---+---+---+---+---+---+---+---+
| data length                   |
+---+---+---+---+---+---+---+---+
| data ...                      |
+---+---+---+---+---+---+---+---+


Sample Context Specific Tag:
0C 02 00 00 F5
0C => 0000 1100
      tttt clll
fieldnamevalue
tttttag number0
cclass1
llllength4


dddd dddd ddii iiii iiii iiii iiii iiii
0000 0010 0000 0000 0000 0000 1111 0101
020000F5Object type(top 10 bits) = 8 (device)
020000F5Instance Number(bottom 22 bits) = 245

See also:
embedded systems - bacnet - Application Tag
embedded systems - bacnet - PD tags

embedded systems - bacnet - Context Tag
filename:embedded systems - bacnet - Context Tag
filename:embedded%20systems%20%2D%20bacnet%20%2D%20Context%20Tag
last edit:June 14 2015 16:57:08 (3247 days ago)
ct = 1714942069.000000 = May 05 2024 16:47:49
ft = 1434315428.000000 = June 14 2015 16:57:08
dt = 280626641.000000